<template>
	<view class="col363636 f26r pl20r pr20r">
		<view class="disFlex aliItCenter h100r borB1SE8e8e8">
			<view class="w160r teAliRight borR1SE8e8e8">
				标题：
			</view>
			<view class="flex1 pl20r">
				<input type="text" placeholder="请输入标题"
					class="f26r h60r" v-model="newObj.title"
				>
			</view>
		</view>
		<view class="disFlex aliItCenter h100r borB1SE8e8e8">
			<view class="w160r teAliRight borR1SE8e8e8">
				介绍：
			</view>
			<view class="flex1 pl20r">
				<input type="text" placeholder="请输入介绍"
					class="f26r h60r" v-model="newObj.introduce"
				>
			</view>
		</view>
		<view class="disFlex aliItCenter h100r borB1SE8e8e8">
			<view class="w160r teAliRight borR1SE8e8e8">
				内容：
			</view>
			<view class="flex1 pl20r">
				<input type="text" placeholder="请输入内容"
					class="f26r h60r" v-model="newObj.content"
				>
			</view>
		</view>
		<button class="colFff lh70r mt40r f26r backCol64aeb4"
			@click="cliSubBtn"
		>
			提交
		</button>
	</view>
</template>
<script>
import { inquiryToLogin } from '@/utils/utils.js'
import { createTeaMessage } from '@/utils/api.js'
export default {
	data() {
		return {
			newObj: {
				token: '',
				status: 2,
				title: '',
				introduce: '',
				content: ''
			}
		}
	},
	onShow() {
		inquiryToLogin().then(res => {
			this.newObj.token = res;
		});
	},
	methods: {
		cliSubBtn() {
			if(!this.newObj.title) return uni.showToast({ title: '请输入标题', icon: 'none' })
			if(!this.newObj.introduce) return uni.showToast({ title: '请输入介绍', icon: 'none' })
			if(!this.newObj.content) return uni.showToast({ title: '请输入内容', icon: 'none' })
			createTeaMessage(this.newObj).then(res => {
				console.log(11, res)
				this.newObj.title = '';
				this.newObj.introduce = '';
				this.newObj.content = '';
				uni.showToast({
					title: '新增群发消息成功', duration: 3000
				})
			})
		}
	}
}
</script>
<style>
</style>